/*
 * ========================================================================
 *
 *       Filename:  testboard.h
 *
 *    Description:  This defines the class that serves as the panel for
 *                  the test board.
 *
 *        Version:  1.0
 *        Created:  05/11/2010 08:51:04 PM
 *       Revision:  none
 *       Compiler:  g++
 *
 *         Author:  Alex Avance (aa), aravance@gmail.com
 *        Company:  independent
 *
 * ========================================================================
 *
 * Copyright (C) 2010 Alex Avance
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-
 * 1307, USA.
 *
 * ========================================================================
 */
#ifndef _TESTBOARD_H_
#define _TESTBOARD_H_

#include "wx/frame.h"
#include "wx/panel.h"
#include "wx/button.h"
#include "wx/stattext.h"
#include "cstmtxtctrl.h"
#include "statinfo.h"
#include "deck.h"

class TestBoardPanel: public wxPanel, public StatInfo
{
public:
  // ====================  LIFECYCLE      ===============================
  TestBoardPanel ( wxFrame *parent, StudyDeck &deck );
  ~TestBoardPanel ();

  // ====================  ACCESSORS      ===============================
  bool IsModified () const;

  // ====================  MUTATORS       ===============================
  void Unmodified ();
  void Reset ();
  void Update ();
  void UpdateStatus ();

  void DrawCard ();
  void ResetDecks ();

  bool Guess ( wxString guess );

  virtual bool Show ( bool show= true );

  bool ConfirmSwitch ( bool force= false );

  // ====================  EVENT HANDLERS ===============================
  void OnIgnoreCase ( wxCommandEvent &event );
  void OnIgnorePunct ( wxCommandEvent &event );
  void OnKeepRight ( wxCommandEvent &event );
  void OnRandomSide ( wxCommandEvent &event );
  void OnFrontSide ( wxCommandEvent &event );
  void OnBackSide ( wxCommandEvent &event );

  void OnTextEnter ( wxCommandEvent &event );

  void OnReset ( wxCommandEvent &event );
  void OnShuffle ( wxCommandEvent &event );
  void OnSkip ( wxCommandEvent &event );
  void OnEnter ( wxCommandEvent &event );
  void OnDraw ( wxCommandEvent &event );

  // ====================  DATA MEMBERS   ===============================
protected:
  wxFrame *m_Parent;

  wxStaticText *m_TextQuestion;
  wxStaticText *m_TextResult;
  CustomTextCtrl *m_TextAnswer;

  wxButton *m_ButtonReset;
  wxButton *m_ButtonShuffle;
  wxButton *m_ButtonSkip;
  wxButton *m_ButtonEnter;
  wxButton *m_ButtonDraw;

  StudyDeck &m_Deck;
  StudyDeck m_RightPile;

  wxString m_Question;
  wxString m_Answer;

  bool m_IgnoreCase;
  bool m_IgnorePunct;
  bool m_KeepRight;
  bool m_Modified;
  bool m_SessionActive;


  enum SideChoice
  {
    RandomSide= 0,
    FrontSide,
    BackSide,
  } m_SideChoice;

private:
  DECLARE_EVENT_TABLE();
}; // ----- end of class TestBoardPanel -----

#endif // _TESTBOARD_H_

